;; This is my start up shepherd program
;; New option '--fg-daemon'.  This is the same as '--daemon', except
;; it runs in the foreground and does not fork.  This is intended for
;; modern init systems such as systemd, which manage many of the traditional
;; aspects of daemon behavior themselves.  '--bg-daemon' is now an alias
;; for '--daemon'.
(define emacs (make <service>
                #:provides '(emacs)
                #:requires '() ;;I should consider using emacs --fg-daemon
                #:start (make-system-constructor "emacs --daemon")
                #:stop (make-system-constructor "emacsclient --eval \"(kill-emacs)\"")
                ))

(define icecat (make <service>
                 #:provides '(icecat)
                 #:requires '(networking)
                 #:start (make-system-constructor "icecat")
                 ;; how do I stop icecat???
                 ))

(define sway (make <service>
               #:provides '(sway)
               #:requires '()
               #:start (make-system-constructor "exec sway")
               #:stop (make-system-constructor "swaymsg exit") ;; or exec swaymsg exit??
               ))

(register-services emacs)

;;(action 'shepherd 'daemonize)

;; send shepherd into background

;; (for-each start (list emacs))
;; services to start automatically
